2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #import "ESGaimICQAccountViewController.h"
18 #import <Adium/AIAccount.h>
19 #import <AIUtilities/AIPopUpButtonAdditions.h>
20 #import <AIUtilities/AIMenuAdditions.h>
22 @interface ESGaimICQAccountViewController (PRIVATE)
23 - (NSMenu *)encodingMenu;
24 - (void)addEncodingItemsWithNames:(NSArray *)inArray withTitle:(NSString *)inTitle toMenu:(NSMenu *)menu;
27 @implementation ESGaimICQAccountViewController
29 - (NSString *)nibName{
30 return(@"ESGaimICQAccountView");
38 [popUp_encoding setMenu:[self encodingMenu]];
42 - (void)configureForAccount:(AIAccount *)inAccount
44 [super configureForAccount:inAccount];
45 [popUp_encoding selectItemWithRepresentedObject:[account preferenceForKey:KEY_ICQ_ENCODING
46 group:GROUP_ACCOUNT_STATUS]];
50 - (void)saveConfiguration
52 [super saveConfiguration];
53 [account setPreference:[[popUp_encoding selectedItem] representedObject]
54 forKey:KEY_ICQ_ENCODING
55 group:GROUP_ACCOUNT_STATUS];
58 - (NSMenu *)encodingMenu
60 NSMenu *menu = [[NSMenu alloc] init];
64 //We'll do custom enabling/disabling and not change it after then, so we don't want auto menuItem validation
65 [menu setAutoenablesItems:NO];
67 title = @"European languages";
68 nameArray = [NSArray arrayWithObjects:
104 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
106 title = @"Semitic languages";
107 nameArray = [NSArray arrayWithObjects:
116 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
119 nameArray = [NSArray arrayWithObjects:
127 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
130 nameArray = [NSArray arrayWithObjects:
142 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
145 nameArray = [NSArray arrayWithObjects:
151 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
154 nameArray = [NSArray arrayWithObjects:
157 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
160 nameArray = [NSArray arrayWithObjects:
164 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
167 nameArray = [NSArray arrayWithObjects:
170 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
173 nameArray = [NSArray arrayWithObjects:
178 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
181 nameArray = [NSArray arrayWithObjects:
185 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
187 title = @"Vietnamese";
188 nameArray = [NSArray arrayWithObjects:
193 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
203 return([menu autorelease]);
206 - (void)addEncodingItemsWithNames:(NSArray *)inArray withTitle:(NSString *)inTitle toMenu:(NSMenu *)menu
208 NSEnumerator *enumerator;
210 NSMenuItem *menuItem;
213 menuItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:inTitle
217 [menuItem setEnabled:NO];
218 [menu addItem:menuItem];
220 canIndent = [menuItem respondsToSelector:@selector(setIndentationLevel:)];
222 enumerator = [inArray objectEnumerator];
223 while(name = [enumerator nextObject]){
224 menuItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:name
228 [menuItem setRepresentedObject:name];
229 if(canIndent) [menuItem setIndentationLevel:1];
231 [menu addItem:menuItem];